<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/tlds/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tlds/fmt.tld" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/tlds/tiles-jsp.tld" prefix="tiles"%>
<c:set var="appCtx" value="${pageContext.request.contextPath}" />

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><tiles:getAsString name="pageTitle" /></title>
<tiles:insertAttribute name="common-resources" />
<script>
	$(function() {
		// Botones de la pagina
		$("#verifica").button();
		$("#cancelar").button();

		$("#verifica").click(function() {
			
			var tipoDocumento = $("#tipoDocumento option:selected").val();
			var numeroDocumento = $("#numeroDocumento").val();
			
			if(tipoDocumento!='0' && numeroDocumento!=''){
				$("#buttonsBox").css("display","none");
				$("#msgWait").css("display","inline");
				$("#atencionInicialForm").submit();	
			}else{
				alert("Debe cargar el tipo y numero de Documento");
				return false;
			}
		});

		$("#cancelar").click(function() {
			$("#tipoDocumento option[value=0]").attr("selected", true);
			$("#numeroDocumento").attr("value", "");
			return false;
		});
		
	});
</script>
</head>
<body>
<div id="layoutContainer">
	<table id="layout">
	<tr><td colspan="2" id="header"><tiles:insertAttribute name="header" /></td></tr>
	<tr><td id="strut" colspan="2"></td></tr>
	<tr id="middle">
		<td id="navigation-menu"><tiles:insertAttribute name="navigation-menu" /></td>
			<!-- INICIO DEL CONTENT -->
			<td id="content">
				<div>

				<!-- Title -->
				<div class="pageTitle"><tiles:getAsString name="pageTitle" /></div> 
				
				<br /><br /><br />
				
				
				<!-- FORMULARIO DE ACCION DE LA PAGINAS -->	
				<form class="form" id="atencionInicialForm" 
					action="${appCtx}/registroInicial" method="post">

					<fieldset>
						<legend class="formTitle">
							&nbsp;<fmt:message key="label.workerData"/>&nbsp;
						</legend>
						<table cellpadding="0" cellspacing="0" border="0">
							<tr>

								<td class="label">
									<fmt:message key="label.workerData.document"/>
								</td>
								<td class="inputTD">
									<select class="inputEditStyle" 
									name="tipoDocumento" id="tipoDocumento">
										<c:forEach var="tipoDocumento" items="${tiposDeDocumentos}">
											<option value="<c:out value="${tipoDocumento.key}"/>">
												<c:out value="${tipoDocumento.value}" />
											</option>
										</c:forEach>
									</select>
								</td>
								
								<td class="label" >
									<fmt:message key="label.workerData.identificationNumber"/>
								</td>
								<td class="inputTD">
									<input class="inputEditStyle" id="numeroDocumento" 
									name="numeroDocumento" value=""
									size="20" maxlength="8" type="text" />
								</td>
							</tr>
							<tr><td>&nbsp;</td></tr>
						</table>
					</fieldset>
				</form>
				<br />
				<!-- TABLA CON LOS BOTONES DE ACCION -->
				<table border="0" style="width:100%;padding-right:15px;" id="buttonsBox">
					<tr>
						<td align="right" class="formActions">
							<button id="verifica">
								<fmt:message key="button.next"/>
							</button>
						&nbsp;
							<button id="cancelar">
								<fmt:message key="button.cancel"/>
							</button>
						</td>
					</tr>
				</table>
				
				<br /><br />
				<!-- DIV DE MENSAJE DE ESPERA AL CARGAR UNA ACCION -->
				<table style="margin-left: auto; margin-right: auto;">
					<tr>
						<td>
							<span id="msgWait" class="waitMessage">
								<fmt:message key="message.pleaseWaitWhileProcessing" />.
							</span>
						</td>
					</tr>
				</table>
								
			</div>
			<!-- FIN DEL CONTENT -->
			</td>
			</tr>
	<tr><td colspan="2"><tiles:insertAttribute name="footer" /></td></tr>
</table>
</div>
</body>
</html>